<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
include_once 'MySqlDataAccessHelper.php';

/**
 * Description of Word
 *
 * @author Phuong Vu
 */
class Question {
    public $ID;
    public $Title;
    public $IDListen;
    public $Answer1;
    public $Answer2;
    public $Answer3;
    public $Answer4;
    public $Right_Answer;
    public $User_Answer;
    
    function loadQuestionByListen($idListen) {
        try {
            $connection = new MySqlDataAccessHelper();
            $connection->open();

            $sql = "select* from question where IDListen =" . $idListen;
            $result = $connection->executeQuery($sql);
            $listQuestion = array();
            while ($row = mysql_fetch_object($result)) {
                $temp = new Question();
                $temp = $row;

                $listQuestion[] = $temp;
            }

            $connection->close();

            return $listQuestion;
        } catch (Exception $e) {
            $connection->close();
            return false;
        }
    }

}